import { View } from "../../../mvc/core/View";
import { LayerManager } from "../../manager/LayerManager";
import { ObjCreate } from "../common/ObjCreate";
import { ResFileConst } from "../../resource/ResFileConst";
import { EffectManager } from "../../manager/EffectManager";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { ParamsConst } from "../../../common/global/ParamsConst";
import { BrowerUtil } from "../../../../com/gengine/utils/BrowerUtil";
import { Alert } from "../../../../com/mui/controls/Alert";
import { IssmAlertWin } from "../common/alertwins/IssmAlertWin";
import { GLoadedButton } from "../../../../com/mui/controls/GLoadedButton";
//class SIssmHintIcon
    
    export  class SIssmHintIcon extends View
    {
        constructor()
        {
            super();
            this.layer = LayerManager.issmBtnLayer;
            this.createChildren();
            return;
        }

        /* internal  */createChildren(): void
        {
            this.hintIcon = ObjCreate.createGLoadedButton(ResFileConst.Fatigue, 0, 0, 32, 32, this);
            this.hintIcon.buttonMode = true;
            this.hintIcon.addEventListener(flash.events.MouseEvent.CLICK, this.onClick);
            this.hintIcon.visible = false;
            return;
        }

        /* internal  */onClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            SIssmHintIcon.gotoIssm();
            return;
        }

        public showHint(): void
        {
            this.hintIcon.visible = true;
            this.show();
            this.x = 100;
            this.y = 100;
            return;
        }

        public hideHint(): void
        {
            this.hintIcon.visible = false;
            this.hide();
            return;
        }

        public flashAlert(arg1: Boolean): void
        {
            if (arg1) 
            {
                if (this._secTimer == null) 
                {
                    this._secTimer = new Object /* flash.utils.Timer */(1000);
                    this._secTimer.repeatCount = 300;
                    this._secTimer.addEventListener(flash.events.TimerEvent.TIMER_COMPLETE, this.onSecTimerCompleteHandler);
                }
                this._secTimer.reset();
                this._secTimer.start();
                EffectManager.glowFilterReg(this, [FilterConst.uiBtnFilter]);
            }
            else 
            {
                if (this._secTimer) 
                {
                    this._secTimer.stop();
                }
                EffectManager.glowFilterUnReg(this);
            }
            return;
        }

        /* internal  */onSecTimerCompleteHandler(arg1: Object /* flash.events.TimerEvent */): void
        {
            if (this._secTimer) 
            {
                this._secTimer.stop();
            }
            EffectManager.glowFilterUnReg(this);
            return;
        }

        public static gotoIssm(): void
        {
            var loc1=ParamsConst.instance.proctecUrl;
            if (!(loc1 == null) && !(loc1 == "")) 
            {
                BrowerUtil.getUrl(loc1, "_blank");
            }
            else 
            {
                Alert.mode = Alert.Mode_NoneNotModal;
                Alert.alertWinRenderer = IssmAlertWin;
                Alert.show();
            }
            return;
        }

        /* internal */ /* var */hintIcon: GLoadedButton;

        /* internal */ /* var */_secTimer: Object /* flash.utils.Timer */;
    }
